﻿/**
 * @file   FITKAbaqusAdaptorConnectorSection.h
 * @brief 连接器截面 适配器 用于INP文件的Connector Section读写
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date 2024-06-24
 */
#ifndef __FITKABAQUSADAPTORCONNECTORSECTION__H__
#define __FITKABAQUSADAPTORCONNECTORSECTION__H__

#include "FITKAbaqusAbstractAdaptor.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

ForwardDeclarNS(Interface, FITKAbstractModel)
ForwardDeclarNS(Interface, FITKAbaConnectorAssignment)
ForwardDeclarNS(Interface, FITKAbaConnectorBehavior)
ForwardDeclarNS(Interface, FITKAbaConnectorSection)
ForwardDeclarNS(Interface, FITKAbaConnectorBehaviorElasticity)
ForwardDeclarNS(Interface, FITKAbaAssEleCONN3D2)

namespace IO
{
    /**
     * @brief 连接器截面 读写适配器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date 2024-06-20
     */
    class FITKAbaqusIOINPAPI FITKAbaqusAdaptorConnectorSection : public FITKAbaqusAbstractAdaptor
    {
    public:
        explicit FITKAbaqusAdaptorConnectorSection() = default;
        ~FITKAbaqusAdaptorConnectorSection() = default;

        /**
         * @brief 获取适配器数据类型名
         * @return 适配器数据类型名
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        QString getAdaptorClass() override;

        /**
         * @brief 设置连接器指派
         * @param[i] assignData Interface::FITKAbaConnectorAssignment*
         * @param[i] modelData Interface::FITKAbstractModel*
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-24
         */
        void setConnectorAssignmentModelData(Interface::FITKAbaConnectorAssignment* assignData, Interface::FITKAbstractModel* modelData);

        /**
         * @brief 设置写出动作状态
         * @param[i] writeBehavior 是否写出动作
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        void setWriteBehavior(bool writeBehavior = false);

        /**
         * @brief 设置写出单元的编号
         * @param writeElementId elementId
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-28
         */
        void setWriteElementId(int* writeElementId);

        /**
         * @brief 适配器读取
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        bool adaptR() override;

        /**
         * @brief 适配器写出
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-20
         */
        bool adaptW() override;

    private:
        /**
         * @brief 读取连接器section
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectSection();
        /**
         * @brief 写出连接器section
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeConnectSection();
        /**
         * @brief 写出Element type=CONN3D2
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeElementCONN3D2();
        /**
         * @brief 读取section类型
         * @param line 读取的数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-24
         */
        bool readConnectSectionType(QString line);
        /**
         * @brief 写出section类型
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-07-01
         */
        bool writeConnectSectionType();
        /**
         * @brief 读取连接器section行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectSectionBehavior();
        /**
         * @brief 写出连接器section行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool writeConnectSectionBehavior();
        /**
         * @brief 读取弹性行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectElasticityBehavior();
        /**
         * @brief 写出弹性行为
         * @param[i] behaviorData Interface::FITKAbaConnectorBehavior* 行为数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeConnectElasticityBehavior(Interface::FITKAbaConnectorBehavior* behaviorData);
        /**
         * @brief 读取阻尼行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectDampingBehavior();
        /**
         * @brief 写出阻尼行为
         * @param[i] behaviorData Interface::FITKAbaConnectorBehavior* 行为数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeConnectDampingBehavior(Interface::FITKAbaConnectorBehavior* behaviorData);
        /**
         * @brief 读取塑性行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectPlasticityBehavior();
        /**
         * @brief 写出塑性行为
         * @param[i] behaviorData Interface::FITKAbaConnectorBehavior* 行为数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeConnectPlasticityBehavior(Interface::FITKAbaConnectorBehavior* behaviorData);
        /**
         * @brief 读取停止行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectStopBehavior();
        /**
         * @brief 写出停止行为
         * @param[i] behaviorData Interface::FITKAbaConnectorBehavior* 行为数据
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool writeConnectStopBehavior(Interface::FITKAbaConnectorBehavior* behaviorData);
        /**
         * @brief 读取锁定行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool readConnectLockBehavior();
        /**
         * @brief 写出锁定行为
         * @return 状态 true成功， false失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-25
         */
        bool writeConnectLockBehavior(Interface::FITKAbaConnectorBehavior* behaviorData);

    private:
        /**
         * @brief 模型数据 part assembly instance
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-21
         */
        Interface::FITKAbstractModel* _modelData{};
        /**
         * @brief 连接器数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-24
         */
        Interface::FITKAbaConnectorAssignment* _connectAssignData{};
        /**
         * @brief 写出动作
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-06-27
         */
        bool _writeBehavior{ false };
        /**
         * @brief 写出element编号标记用于累加
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-05-30
         */
        int* _writeElementId{};
    };
    Register2FITKIOAdaptorFactory(INP, Interface::FITKAbaConnectorSection, FITKAbaqusAdaptorConnectorSection)
}

#endif